<?php
/**
 * Klasse zum erstellen eines Grid
 *
 * @author		Joachim Ruf, Loresoft Software (http://www.loresoft.de)
 * @license		New BSD License
 * @version		Class for Bootstrap v2.3.2
 *
 * */


Class Bootstrap_Grid_Handler
{
	private $arrRow			= array();


	/**
	 * */
	function __construct () {
	}


	/**
	 * Liefert eine Zeile zurueck.
	 * @param int $_size		: Breite {1-12}
	 * @param string $_content	: Auszugebender Content
	 * @return Bootstrap_Grid_Row
	 * */
	public function addRow ($_fluid = false, array $_arrParam = array()) {
		return $this->arrRow[] = new Bootstrap_Grid_Row($_fluid, $_arrParam);
	}


	/**
	 * Liefert eine Zeile zurueck.
	 * @param int $i	: Auszugebende Zeile
	 * @return Yapary_Form_Formular_Row
	 * */
	public function get ($i) {
		if (!isset($this->arrRow[$i])) {
			return NULL;
		}

		return $this->arrRow[$i];
	}


	/**
	 * @desc Liefert alle Zeilen zurueck.
	 * @return Yapary_Form_Formular_Row[]
	 * */
	public function getList () {
		return $this->arrRow;
	}


	/**
	 * Loescht einen Eintrag.
	 * @param string $id	: Zu loeschender Eintrag
	 * @return bool
	 * */
	public function delete ($i) {
		if (!isset($this->arrRow[$i])) {
			return false;
		}

		unset($this->arrRow[$i]);
		return true;
	}


	/**
	 * @desc Gibt das Grid aus.
	 * @return string
	 * */
	public function display() {
		$result	= NULL;

		if (count($this->arrRow)) {
			/* @var $oRow Bootstrap_Grid_Row */
			foreach ($this->arrRow as $key => $oRow) {
				$result .=	$oRow->display();
			}
		}

		return $result;
	}


}


?>